﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

namespace DbStreamConverter
{

    public class MappingRule<T, TOut> : IMappingRule
    {
        public T Source { get; set; }
        public TOut Target { get; set; }
        public List<T> Buffer { get; set; }

        object IMappingRule.Source
        {
            get
            {
                return Source;
            }
            set
            {
                Source = (T)value;
            }
        }

        object IMappingRule.Target
        {
            get
            {
                return Target;
            }
            set
            {
                Target = (TOut)value;
            }
        }

        IEnumerable IMappingRule.Buffer
        {
            get
            {
                return Buffer;
            }
            set
            {
                Buffer = (List<T>)value;
            }
        }
    }

    public interface IMappingRule
    {
        object Source { get; set; }
        object Target { get; set; }
        IEnumerable Buffer { get; set; }
    }

}
